﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;

using System.Text;
using System.Windows.Forms;

using Microsoft.Reporting.WinForms;
using System.Drawing.Printing;
using System.Linq;

namespace NagnagyPrint
{
    public partial class ReportByIDAndProject : Form
    {




        public Order order;
    
        //private Person currentPerson;
        
        public ReportByIDAndProject()
        {
            InitializeComponent();
           
         
    
     
           
        }
        public void GenerateReportForOrder()
        {
            




          

            this.reportViewer1.LocalReport.DataSources.Clear();
           
            /*
             <ReportParameter Name="ID">
         <ReportParameter Name="Name">  
    <ReportParameter Name="Phone">   
    <ReportParameter Name="Email">
    <ReportParameter Name="Type">     
    <ReportParameter Name="Size">      
    <ReportParameter Name="Amount">
    <ReportParameter Name="Date">   
    <ReportParameter Name="Copies">      
    <ReportParameter Name="UserId">      
    <ReportParameter Name="Directory">     
    </ReportParameter>
             */

            ReportParameter p1 = new ReportParameter("ID", order.token);
            ReportParameter p2 = new ReportParameter("Name", order.name);
            ReportParameter p3 = new ReportParameter("Phone", order.phone);
            ReportParameter p4 = new ReportParameter("Email", order.email);
            ReportParameter p5 = new ReportParameter("Type", order.type);
            ReportParameter p6 = new ReportParameter("Amount", order.amount);
            ReportParameter p7 = new ReportParameter("Date", order.date);
            ReportParameter p8 = new ReportParameter("Copies", order.copies);
            ReportParameter p9 = new ReportParameter("UserId", order.userid);
            ReportParameter p10 = new ReportParameter("Directory", order.Directory);
            ReportParameter p11 = new ReportParameter("Size", order.size);
            ReportParameter p12 = new ReportParameter("more_info", order.more_info);
            

            reportViewer1.LocalReport.SetParameters(new ReportParameter[] { p1, p2, 
                  p3
                , p4
                , p5
                , p6
                 ,p7
                , p8
                , p9
                , p10,p11,p12
            
            });
            reportViewer1.Visible = true;



            this.reportViewer1.RefreshReport();
            //From Item Number 1


             ReportPrintDocument RP = new ReportPrintDocument(reportViewer1.LocalReport);
               RP.Print();
           
        
        
        }

        
        private void button1_Click(object sender, EventArgs e)
        {
        
           
               // add new project event to family 
           
            int result = 0;
             //  oPerson.AddHomeFixesProject(txtAmount.Text,familyid,txtAddress.Text,dateFrom.Value.ToShortDateString(),txtNote.Text);
           if (result > 0)
           {
               //add a moslemFamilyProject

               //  oPerson.ad
               MessageBox.Show("تم اضافة المشروع بنجاح");
               //btnAddFamily.Enabled = false;
           }
    
        }

            private void ReportByDateAndProject_Load(object sender, EventArgs e)
           {

               this.reportViewer1.RefreshReport();
           }
           public static  DataTable createDataTableProjectMoslemFamily()
           {
               //
               // Here we create a DataTable with four columns.
               //
               DataTable table = new DataTable();
               table.Columns.Add("Dosage", typeof(int));
               table.Columns.Add("Drug", typeof(string));
               table.Columns.Add("Patient", typeof(string));
               table.Columns.Add("Date", typeof(DateTime));

               //
               // Here we add five DataRows.
               //
               table.Rows.Add(25, "Indocin", "David", DateTime.Now);
               table.Rows.Add(50, "Enebrel", "Sam", DateTime.Now);
               table.Rows.Add(10, "Hydralazine", "Christoff", DateTime.Now);
               table.Rows.Add(21, "Combivent", "Janet", DateTime.Now);
               table.Rows.Add(100, "Dilantin", "Melanie", DateTime.Now);
               return table;
           }

           private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
           {
              // MessageBox.Show(drpProject.SelectedValue.ToString());
           }

           private void reportViewer1_Load(object sender, EventArgs e)
           {

           }

        }

   
    }



